<div class="uploadWrapper${fieldname}">
	<input type="file" lay-type="file" class="layui-upload-file" name="file" id="uploadBtn_${fieldname}" >
	<input type="hidden" name="${fieldname}_path" id="${fieldname}_path" value="${path!''}" />
	<input type="hidden" name="${fieldname}_name" id="${fieldname}_name" value="${name!''}" />
	<span id="span_${fieldname}"></span>
</div>
<script type="text/javascript">

layui.use(['form', 'layedit', 'laydate','upload'], function(){
    var form = layui.form()
        ,layer = layui.layer
        ,layedit = layui.layedit
        ,laydate = layui.laydate;
    
    layui.upload({
	    url: '${ctx}/eop/upload/uploadFile.do?subFolder=cms&ajax=1'
	    ,elem: '#uploadBtn_${fieldname}' //指定原始元素，默认直接查找class="layui-upload-file"
	    ,method: 'post' //上传接口的http类型
	    ,success:function(res){
			$("#${fieldname}_path").val(res.path);
	    	$("#${fieldname}_name").val(res.filename);
		},
		error:function(){
			alert("上传错误，请重试");
		}
	 });
});

function ${fieldname}getPath(data){
	$("#${fieldname}_path").val(data.path);
	$("#${fieldname}_name").val(data.filename);
	$("#span_${fieldname}").html('<a target="_blank" href="' + data.path + '">' + data.filename + '</a>');
}

$(function(){
	<#if path?exists && path!='' >
		$("#span_${fieldname}").html('<a target="_blank" href="${path}">${name}</a>');
	<#else>
		$("#span_${fieldname}").empty();
	</#if>
});
</script>


